/**
 * Author: Shen Yanqiu
 * Date: 2017-12-09
 * Time: 17:42
 *
 */
import React from 'react';
import { Button, Row, Col } from 'antd';
import { config } from 'utils';
import { routerRedux } from 'dva/router';
import styles from './index.less';
import { connect } from "dva";
import PropTypes from "prop-types";

class Organization extends React.Component {
  static propTypes = {
    dispatch: PropTypes.func,
  };
  render () {
    const { dispatch } = this.props;
    // 跳转到加入组织
    const join = () => {
      dispatch(
        routerRedux.push('joinorganization')
      );
    };
    // 跳转到创建组织
    const create = () => {
      dispatch(
        routerRedux.push('createorganization')
      );
    };
    return (
      <div className={styles.form}>
        <div className={styles.logo}>
          <img alt={'logo'} src={config.logo} />
          <span>欢迎来到{config.name}</span>
        </div>
        <div>
          <p>
            检测到您目前没有加入任何组织，请您尽快选择加入相关组织，若您是组织
            管理人员，请尽快创建组织，谢谢！
          </p>
        </div>
        <div className={styles.ButtonGroup}>
          <Row>
            <Col span={12}>
              <Button type="primary" onClick={join}>加入组织</Button>
            </Col>
            <Col span={12}>
              <Button type="primary" onClick={create}>创建组织</Button>
            </Col>
          </Row>
        </div>
      </div>
    );
  }
}
export default connect()(Organization);
